//
//  KTTools.swift
//  KOLToken
//
//  Created by san.yang on 2020/3/5.
//  Copyright © 2020 iOS-team. All rights reserved.
//

import UIKit
import DynamicColor
enum KTFont: String {
    
    case PingFangSC_Light = "PingFangSC-Light"
    case PingFangSC_Medium = "PingFangSC-Medium"
    case PingFangSC_Regular = "PingFangSC-Regular"
    
    func fontSize(_ size: CGFloat) -> UIFont{
        return UIFont.init(name: self.rawValue, size: size) ?? UIFont.systemFont(ofSize: size)
    }
}

enum KTColor: UInt32 {
    
    case color_6AFFA3 = 0x6AFFA3
    case color_00FFFE = 0x00FFFE
    case color_364059 = 0x364059
    case color_14CC5B = 0x14CC5B
    case color_F5A623 = 0xF5A623
    case color_FF384A = 0xFF384A
    case color_1980FA = 0x1980FA
    case color_212121 = 0x212121
    case color_BDBDBD = 0xBDBDBD
    case color_616161 = 0x616161
    case color_E0E0E0 = 0xE0E0E0
    case color_FAFAFA = 0xFAFAFA
    // MARK:-

    func color(_ alpha: CGFloat = 1.0) -> UIColor{
        return DynamicColor(hex: self.rawValue).withAlphaComponent(alpha)
    }
}

////MARK: - 全局error
//public enum DError: Swift.Error {
//    case jsonMapping(ResponseData)
//}
//
////MARK: - 全局通知
//extension NSNotification.Name {
//    // 登录异常（未登录、token过期）
//    static let loginError = NSNotification.Name("loginError")
//}

//MARK: - 日志输出
// <T>: 为泛型，外界传入什么就是什么
func KTLog<T>(_ message: T, file: String = #file, line: Int = #line) {
    
    #if DEBUG
    print("🔥🔥🔥[\(line)]:\(message)")
    #else
    
    #endif
}

